<template>
  <div>
    <!-- 搜索 -->
    <div class="section1">
      <div class="section1-1">
        <i class="el-icon-search" @click="sousuo"></i>
        <input
          type="text"
          placeholder="请输入内容"
          v-model="filterText"
          class="input1"
        />
      </div>
    </div>
    <!-- 表格数据 -->
    <div>
      <el-table :data="tableData" style="width: 100%">
        <el-table-column prop="user_id" label="用户id"></el-table-column>
        <el-table-column prop="user_name" label="微信用户名"></el-table-column>
        <el-table-column
          prop="invite_code"
          label="邀请码"
          width="80"
        ></el-table-column>
        <el-table-column
          prop="user_creattime"
          label="创建时间"
        ></el-table-column>
        <el-table-column
          prop="user_last_login_time"
          label="最后一次登录时间"
        ></el-table-column>
        <el-table-column prop="proxy_id" label="代理级别"></el-table-column>
        <el-table-column prop="user_phone" label="手机号"></el-table-column>
        <el-table-column prop="user_pid" label="父级id"></el-table-column>
        <el-table-column
          prop="safetyInfo.account_money"
          label="余额"
        ></el-table-column>
        <el-table-column
          prop="safetyInfo.alipay_account"
          label="支付宝账号"
        ></el-table-column>
        <el-table-column
          prop="safetyInfo.pay_password"
          label="支付密码"
        ></el-table-column>

        <el-table-column label="操作" width="60">
          <template slot-scope="scope">
            <el-dropdown>
              <span class="el-dropdown-link">
                <i class="el-icon-arrow-down el-icon--right"></i>
              </span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item @click.native="modify(scope.row, 0)"
                  >编辑</el-dropdown-item
                >
                <!-- <el-dropdown-item @click.native="modify(scope.row,1)">复制</el-dropdown-item>
                <el-dropdown-item @click.native="modify(scope.row,2)">删除</el-dropdown-item>
                <el-dropdown-item @click.native="modify(scope.row,3)">禁用</el-dropdown-item> -->
                <!-- <el-dropdown-item command="d" disabled>双皮奶</el-dropdown-item>
                <el-dropdown-item command="e" divided>蚵仔煎</el-dropdown-item>-->
              </el-dropdown-menu>
            </el-dropdown>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <!-- 分页 -->
    <div class="paging">
      <el-pagination
        @current-change="handleCurrentChange"
        :current-page.sync="currentPage"
        :page-size="pageNum"
        layout="prev, pager, next, jumper"
        :total="drugList"
      ></el-pagination>
    </div>
  </div>
</template>
<script>
import axios from 'axios';
export default {
  data() {
    return {
      filterText: '',
      tableData: [],
      currentPage: 1,
      pageNum: 6,
      drugList: 0,
    };
  },
  computed: {},
  mounted() {
    let nowPage = parseInt(this.currentPage);
    console.log(this.currentPage);
    axios
      .get('http://192.168.43.75/admin/selUser', {
        params: {
          pages: nowPage,
          pageSize: 6,
        },
      })
      .then((r) => {
        console.log(r);
        this.drugList = r.data.counts;
        this.tableData = r.data.data;
      });
  },
  methods: {
    modify(row, index) {
      // this.$refs.modifyinfo.open(row);
      //返回当前对象
      console.log(row, index);
    },
    sousuo() {
      console.log(1111);
    },
    handleCurrentChange(val) {
      this.nowPage = val;
      console.log(val);
      axios
        .get('http://192.168.43.75/admin/selUser', {
          params: {
            pages: val,
            pageSize: 6,
          },
        })
        .then((r) => {
          console.log(r);
          this.drugList = r.data.counts;
          this.tableData = r.data.data;
        });
    },
  },
};
</script>
<style scoped>
.section1-1 {
  width: 190px;
  border-bottom: 1px solid gainsboro;
  display: flex;
  justify-content: center;
  align-items: center;
}
.input1 {
  width: 150px;
  height: 30px;
  border: none;
  margin-left: 10px;
  outline: none;
}
.paging {
  margin-top: 30px;
  margin-left: 30%;
}

.el-pagination >>> .el-pagination__jump {
  font-size: 17px;
}
.el-pagination >>> .el-icon {
  font-size: 17px;
}
.el-pagination >>> .number {
  font-size: 17px;
  width: 60px;
}
</style>